#pragma once

#include <AVUITypeConverter.h>

namespace AVUI {

class EnumClass : public TypeConverter
{
public:
    ObjectPtr FromString(const char*) const;

protected:
    EnumClass(const Type& type) { };
    ~EnumClass() { };

    struct EnumStringMapping
    {
        int value;
        const WCHAR* wzName;
    };

    static bool ValidateValueWithMapping(int value, const EnumStringMapping* rgMapping, int cMapping);

    virtual const EnumStringMapping* get_Mapping() const = 0;
    virtual unsigned int get_MappingCount() const = 0;

    virtual bool CanConvertFrom(Object* pContext, const Type& type) const;
    virtual ObjectPtr ConvertFrom(Object* pContext, Object* pObjectFrom) const;
    virtual bool CanConvertTo(Object* pContext, const Type& type) const { return false; };
    virtual ObjectPtr ConvertTo(Object* pContext, Object* pObjectFrom, const Type& type) const { LibraryCriticalError(); return NULL; }
};


}; // namespace AVUI
